﻿using UnityEngine;
using System.Collections;

namespace UI
{
    public class UICopyDropItem : MonoBehaviour
    {

        //public UISprite frame;
        public TextureKit itemIcon;
        public GameObject firstDrop;
        public GameObject levelBk;
        public UILabel number;

        UICopy copy;

        #region event
        public UICopyEvent copyEvent;
        #endregion

        public void Init(string id,int number,bool first=false)
        {
            this.levelBk.SetActive( false );

            bool isFrag=false;
            TextureIcon iconType = TextureIcon.ITEM;
            string icon = UIDropSimpleParser.Icon( id, out iconType, out isFrag );

            this.itemIcon.iconType = iconType; 
            this.itemIcon.textureName = icon;
            if( this.number!=null )
            {
                if( number>1 )
                {
                    this.number.gameObject.SetActive( true );
                    this.number.text = number.ToString();
                }
                else
                {
                    this.number.gameObject.SetActive( false );
                }
            }
            this.itemIcon.GetComponent<TextureKit>().texture.width  = 80;
            this.itemIcon.GetComponent<TextureKit>().texture.height = 80;
            firstDrop.SetActive( false );
        }


    }
}